import xlwt
import numpy as np
from pandas import DataFrame


class output_table:


    def __init__(self,person_state, isolation_state, Frequency_total, N):
        self.Frequency_total = Frequency_total
        self.person_state = person_state
        self.isolation_state = isolation_state
        self.N = N


    def output_table_summary(self, diagnosis_rate_is, diagnosis_rate, S, H, IN, A, R, IS, C, D, Total):
        date = list(range(self.Frequency_total))
        data = {
            'date': date,
            'Total': Total,
            'S': S,
            'H': H,
            'IN': IN,
            'A': A,
            'R': R,
            'IS': IS,
            'C': C,
            'death': D

            # 'rate 1 to 5':
        }
        # list_tabel = [num_state_1, rate_1_to_2, rate_1_to_3, rate_1_to_4, id_1, id_1_2, id_1_3, id_1_4]
        df = DataFrame(data)
        df.to_excel(r'output_file/data.xls')

    def data_10(self, p_t_10, p_t_10_1, list_R_A):
        date = list(range(self.Frequency_total))
        data = {
            'date': date,
            'num 10': p_t_10,
            'num 10 change to 1': p_t_10_1,
            # 'num 10 change to 0': p_t_10,
            'Average risk of infection': list_R_A

        }
        df = DataFrame(data)
        df.to_excel(r'output_file/data_change_10.xls')

    def data_1(self, num_state_1, rate_1_to_2, rate_1_to_3, rate_1_to_4, id_1, id_1_2, id_1_3, id_1_4):
        date = list(range(self.Frequency_total))
        # list_rate_1_to_2 = [rate_1_to_2] * self.Frequency_total
        # list_rate_1_to_3 = [rate_1_to_3] * self.Frequency_total
        # list_rate_1_to_4 = [rate_1_to_3] * self.Frequency_total
        data = {
            'date': date,
            'num 1': num_state_1,
            'num 1 will change': id_1,
            'num 1 to 2': id_1_2,
            'num 1 to 3': id_1_3,
            'num 1 to 4': id_1_4,
            # 'rate 1 to 2': rate_1_to_2,
            # 'rate 1 to 3': rate_1_to_3,
            # 'rate 1 to 4': rate_1_to_4
            # 'rate 1 to 5':
        }
        # list_tabel = [num_state_1, rate_1_to_2, rate_1_to_3, rate_1_to_4, id_1, id_1_2, id_1_3, id_1_4]
        df = DataFrame(data)
        df.to_excel(r'output_file/data_change_1.xls')

    def data_2(self, num_state_2, rate_2_to_3, rate_2_to_4, id_2, id_2_3, id_2_4):
        date = list(range(self.Frequency_total))
        # list_rate_2_to_3 = [rate_2_to_3] * self.Frequency_total
        # list_rate_2_to_4 = [rate_2_to_4] * self.Frequency_total
        data = {
            'date': date,
            'num 2': num_state_2,
            'num 2 will change': id_2,
            'num 2 to 3': id_2_3,
            'num 2 to 4': id_2_4,
            # 'rate 2 to 3': rate_2_to_3,
            # 'rate 2 to 4': rate_2_to_4
            # 'rate 1 to 5':
        }
        # list_tabel = [num_state_1, rate_1_to_2, rate_1_to_3, rate_1_to_4, id_1, id_1_2, id_1_3, id_1_4]
        df = DataFrame(data)
        df.to_excel(r'output_file/data_change_2.xls')

    def data_3(self, num_state_3, p_id_3, is_t_0_2, p_t_3_5, rate_3_to_5, rate_confirmed):
        date = list(range(self.Frequency_total))
        # list_rate_3_to_5 = [rate_3_to_5] * self.Frequency_total
        data = {
            'date': date,
            'num 3': num_state_3,
            'num 3 timeout': p_id_3,
            'num 3 be confirmed': is_t_0_2,
            'num 3 become death': p_t_3_5,
            'rate confirmed': rate_confirmed,
            # 'rate 3 to 5': rate_3_to_5
            # 'rate 1 to 5':
        }
        # list_tabel = [num_state_1, rate_1_to_2, rate_1_to_3, rate_1_to_4, id_1, id_1_2, id_1_3, id_1_4]
        df = DataFrame(data)
        df.to_excel(r'output_file/data_change_3.xls')

    def data_confrimed(self, is_num, change_num, recover_num, death_num, new_num,connet_avg_num, list_NN_A, IS):
        date = list(range(self.Frequency_total))
        data = {
            'date': date,
            'diagnose total': is_num,
            'change_num': change_num,
            'recover_num': recover_num,
            'death_num': death_num,
            'new diagnose': new_num,
            'Average num': connet_avg_num,
            'find num avg': list_NN_A,
            # 'discovery rate': dicovery_rate,
            # 'find num diagnose': find_diagnose,
            'is num  yesterday': IS

        }
        df = DataFrame(data)
        df.to_excel(r'output_file/data_change_4.xls')

    # def daily_diagnosis_neighbor(self,neighbor):
    #     pf = DataFrame(list(neighbor))


